package cn.com.chengq.jsf.bean;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;

@ManagedBean(name="helloWorld", eager = true)
@RequestScoped
public class HelloWorld {

    @ManagedProperty("#{message}")
    private Message messageBean;

    private String message;

    public HelloWorld() {
        System.out.println("HelloWorld:HelloWorld()");
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Message getMessageBean() {
        return messageBean;
    }

    public void setMessageBean(Message messageBean) {
        if (messageBean != null) {
            this.message = messageBean.getMessage();
        }
    }
}
